package com.yulan.two_pair;

import org.junit.Test;

public class LeetCode_66 {
    public int[] constructArr(int[] a){
        int[] res = new int[a.length];
        int left = 1;
        for(int i = 0 ;i<a.length;i++){
            res[i] = left;
            left *= a[i];
        }

        int right = 1;
        for(int i = a.length-1;i>=0;i--){
            res[i] *= right;
            right *= a[i];
        }
        return res;
    }

    @Test
    public void test1(){
        int[] arr = {1,2,3,4,5};
        for(int i : constructArr(arr)){
            System.out.print(i+" ");
        }
    }
}
